package com.aaa.controller;

import com.aaa.entity.County;
import com.aaa.service.CountyService;
import com.github.pagehelper.PageInfo;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@CrossOrigin
@RequestMapping("county")
public class CountyController {
    @Autowired
    CountyService ps;

    @RequestMapping("findCounty")
    public List<County> findCounty(County county){
        return ps.findCounty(county);
    }

    @RequestMapping("findCountyDesc")
    public List<Map> findCountyDesc(){
        return ps.findCountyDesc();
    }

    @RequestMapping("findCountyByCity")
    public PageInfo findCountyByCity( String provName,String city,String county,int page,int size){

       return  ps.findCountyByCity(provName,city,county,page,size);
    }

    @RequestMapping("findCountyById")
    public Map findCountyById(int couId){
        return ps.findCountyById(couId);
    }
    @RequestMapping("updateCounty")
    public int updateCounty(County county){
        return ps.updateCounty(county);
    }
    @RequestMapping("countyAdd")
    public int countyAdd(County county){
        return ps.countyAdd(county);
    }

    @RequestMapping("countyDel")
    public int countyDel(int couId){
        return ps.countyDel(couId);
    }
}
